 {extend name="v1/layout/base"}
 {block name="content"}
 <div class="layuimini-main">
   <script type="text/html" id="toolbar">
     <div class="layui-btn-container">
       <button class="layui-btn layui-btn-black  layui-btn-sm" lay-event="reseve"><i class="layui-icon">&#xe63d;</i></button>
       <button class="layui-btn layui-btn-danger  layui-btn-sm" lay-event="clear" data-url="/{:config('manage.manage_name')}/{:config('manage.version')}/Admin/adminLogClear"><i class="layui-icon layui-icon-delete
 "></i>清除记录</button>
     </div>
   </script>
   <table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>
 </div>
 {/block}
 {block name="myScript"}
 <script>
   layui.use(['form', 'table'], function() {
     var $ = layui.jquery,
       form = layui.form,
       table = layui.table;
     table.render({
       elem: '#currentTableId',
       url: '/{:config("manage.manage_name")}/{:config("manage.version")}/Admin/adminLog',
       toolbar: '#toolbar',
       defaultToolbar: ['filter'],
       cols: [
         [{
             field: 'admin_log_id',
             width: '5%',
             title: 'ID',
             sort: true
           },
           {
             field: 'admin_num',
             width: '10%',
             title: '操作账号',
           },
           {
             field: 'admin_name',
             width: '10%',
             title: '操作人昵称'
           },
           {
             field: 'msg',
             width: '40%',
             title: '操作描述'
           },
           {
             field: 'ip',
             width: '10%',
             title: '操作人ip'
           },
           {
             field: 'update_time',
             width: '12%',
             title: '操作时间'
           },
           {
             title: '操作',
             toolbar: '#currentTableBar',
             align: "center"
           }
         ]
       ],
       limits: [100, 150, 200, 250, 500, 1000],
       limit: 100,
       id: 'table_ids',
       page: true,
       skin: 'line'
     });

     // 顶部操作工具
     table.on('toolbar(currentTableFilter)', function(obj) {
       var url = $(this).attr('data-url');
       switch (obj.event) {
         case 'reseve':
           table.reload('table_ids');
           break;
         case 'clear':
           layer.msg('您确定要清除操作记录吗？', {
             time: 0,
             btn: ['确定', '取消'],
             yes: function(index) {
               layer.close(index);
               https(url, {}, 'post', true, '正在清除操作记录').then(res => {
                 if (res.result_code == 200) {
                   table.reload('table_ids');
                 }
               })
             },
             btn2: function(index) {
               layer.close(index);
             }
           });
           break;
       }
     })
   });
 </script>
 {/block}
